package gtkwire.widget;

import gtkwire.*;
import gtkwire.widget.utils.GtkResizeMode;

/**
*Base class for widgets with two adjustable panes.
*/
public abstract class GtkPaned extends GtkContainer
{
        protected GtkPaned()
        {
		super();
        }

        protected GtkPaned( String name, GladeKey key )
        {
		super( name, key );
        }

	/**
	*Adds a child to the top or left pane with default parameters. 
	*/
	public void add1( GtkWidget widget )
	{
		String[] msg = { widget.getName(), "1" };
		app().sendCommand( name, GTKWireCommand.ADD_PANED, msg);
	}

	/**
	*Adds a child to the bottom or right pane with default parameters.
	*/
	public void add2( GtkWidget widget )
	{
		String[] msg = { widget.getName(), "2" };
		app().sendCommand( name, GTKWireCommand.ADD_PANED, msg);
	}

	/**
	*Adds a child to the top or left pane.
	*@param widget the child to add
	*@param resize should this child expand when the paned widget is resized.
	*@param shrink can this child be made smaller than its requisition.
	*/
	public void pack1( GtkWidget widget, boolean resize, boolean shrink )
	{
		String[] msg = { "1", Boolean.toString( resize ), Boolean.toString( shrink ), widget.getName() };
		app().sendCommand( name, GTKWireCommand.PACK_START, msg);
	}

	/**
	*Adds a child to the bottom or right pane.
	*@param widget the child to add
	*@param resize should this child expand when the paned widget is resized.
	*@param shrink can this child be made smaller than its requisition.
	*/
	public void pack2( GtkWidget widget, boolean resize, boolean shrink )
	{
		String[] msg = { "2", Boolean.toString( resize ), Boolean.toString( shrink ), widget.getName() };
		app().sendCommand( name, GTKWireCommand.PACK_START, msg);
	}

	/**
	*Sets the position of the divider between the two panes in pixels.
	*/
	public void setPosition( int pos )
	{
		app().sendCommand( name, GTKWireCommand.SET_POSITION, pos);
	}

}//end class
